package net.flyinggroup.pagination.event;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.flyinggroup.pagination.session.Session;

import java.time.LocalDate;
import java.util.HashSet;
import java.util.Set;

@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Event {
    @Id
    private Integer id;
    private String name;
    @Column(columnDefinition = "TEXT")
    private String description;
    private LocalDate startDate;
    private LocalDate endDate;
    private LocalDate cfgStartDate;
    private LocalDate cfgEndDate;
    private String location;
    private String website;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
    private Set<Session> sessions = new HashSet<>();

    public Event(Integer id, String name, String description, LocalDate startDate, LocalDate endDate, LocalDate cfgStartDate, LocalDate cfgEndDate, String location, String website) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.startDate = startDate;
        this.endDate = endDate;
        this.cfgStartDate = cfgStartDate;
        this.cfgEndDate = cfgEndDate;
        this.location = location;
        this.website = website;
    }
}
